package com.hrc.rpc.router;


import com.hrc.rpc.common.ServiceMeta;
import lombok.Getter;

import java.util.Collection;

/**
 * 服务元信息缓存类
 */
@Getter
public class ServiceMetaRes {

    // 当前服务节点
    private ServiceMeta curServiceMeta;

    // 剩余服务节点
    private Collection<ServiceMeta> otherServiceMeta;

    public static ServiceMetaRes build(ServiceMeta curServiceMeta, Collection<ServiceMeta> otherServiceMeta) {
        final ServiceMetaRes serviceMetaRes = new ServiceMetaRes();
        serviceMetaRes.curServiceMeta = curServiceMeta;
        otherServiceMeta.remove(curServiceMeta);
        serviceMetaRes.otherServiceMeta = otherServiceMeta;
        return serviceMetaRes;
    }
}
